# Contributor: rubicon <rubicon@mailo.com>
# Maintainer:
pkgname=ocaml-ptime
_pkgname=ptime
pkgver=1.0.0
pkgrel=0
pkgdesc="POSIX time for OCaml"
url="https://erratique.ch/software/ptime"
arch="all !riscv64"  # limited by ocaml aport
license="ISC"
depends="ocaml-runtime"
depends_dev="$pkgname=$pkgver-r$pkgrel"
makedepends="
	ocaml
	ocamlbuild
	ocaml-compiler-libs
	ocaml-findlib
	ocaml-topkg
	cmd:opam-installer
	"
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.bz2::https://erratique.ch/software/ptime/releases/ptime-$pkgver.tbz"
builddir="$srcdir/$_pkgname-$pkgver"
_ocamldir=usr/lib/ocaml

# 32-bit archs
case "$CARCH" in
	arm*|x86) options="$options textrels" ;;
esac

build() {
	ocaml pkg/pkg.ml build
}

package() {
	opam-installer -i \
		--prefix="$pkgdir"/usr \
		--libdir="$pkgdir/$_ocamldir" \
		--docdir="$builddir"/.omit \
		$_pkgname.install
}

dev() {
	default_dev

	cd "$pkgdir"

	local path; for path in $(find $_ocamldir \( \
			-name '*.cmt' -o \
			-name '*.cmti' -o \
			-name '*.cmx' -o \
			-name '*.cmxa' -o \
			-name '*.ml' -o \
			-name '*.mli' \
		\))
	do
		amove "$path"
	done
}

sha512sums="
df2410d9cc25a33083fe968a584b8fb4d68ad5c077f3356da0a20427e6cd8756a5b946b921e5cf8ed4097f2c506e93345d9dca63b113be644d5a7cc0753d1534  ocaml-ptime-1.0.0.tar.bz2
"
